package top.xunfong.auth.controller;

import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import top.xunfong.auth.domain.LoginBody;
import top.xunfong.auth.service.AuthenticationService;
import top.xunfong.common.core.domain.R;
import top.xunfong.common.core.domain.vo.LoginVO;

/**
 * @author: xunfong
 * @date: 2025/10/17 5:39
 */
@RestController
public class TokenController {

    @Resource
    private AuthenticationService authenticationService;

    /**
     * 登陆
     */
    @PostMapping("login")
    public R<LoginVO> login(@RequestBody LoginBody loginBody) {
        return R.ok(LoginVO.builder()
                .token(authenticationService.login(loginBody))
                .build());
    }

    /**
     * 发送验证码
     */
    @GetMapping("code")
    public R<?> code(String phonenumber) {
        return R.ok();
    }

}
